package org.lemon.cla.converter; // 建议放在一个 config 或 converter 包中

import org.lemon.cla.enums.NewsCategoryEnum;
import org.springframework.core.convert.converter.Converter;
import org.springframework.stereotype.Component;

@Component
public class NewsCategoryEnumConverter implements Converter<String, NewsCategoryEnum> {

    @Override
    public NewsCategoryEnum convert(String source) {
        return NewsCategoryEnum.fromDescription(source);
    }
}